#ifndef __APP_LST_H__
#define __APP_LST_H__

#include "testingsystem.pb-c.h"
#include "list.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <unistd.h>
#include <time.h>

#define DEV_ID_LEN              8
#define FILE_COMMAND_SFTP_SHELL "./lst_sftp.sh"

typedef enum _TestingDatas__DevType
{
    TESTING_DATAS_SEND_DEV = 1, //发送设备数据
    TESTING_DATAS_RECV_DEV = 2  //接收设备数据
} TestingDatas__DevType;

typedef struct _Testing_Ids //设备ID集合
{
    struct list_head head;   //id头信息
    char dev_id[DEV_ID_LEN]; //设备ID
} Testing_Ids;

//全局变量
typedef struct _G_Lst_Var
{
    FILE *fp;        //log文件描述符
    char dev_id[10]; //设备ID
} G_Lst_Var;

//函数声明
void send_testing_datas_to_mqtt(TestingDatas *testingdatas, TestingDatas__DevType tpye, uint8_t *mqtt_send_buf, int *mqtt_send_len);
void deal_recv_command(uint8_t *data, int len);
int lst_service_init();

//全局变量
extern G_Lst_Var g_lst_var;
extern TestingDatas g_testing_datas_host;
extern TestingDatas g_testing_datas_remote;
extern Heart g_heart;
#endif